You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR adds the first version of penelope, a Given/When/Then scenario runner for systems that become consistent over time.
Why
decentralization-manager wrote its integration suite in a runner that lived in crates/decman/tests/common/. Other repos could not use the runner without copying it. This crate holds the generic part, so any repo can add it as a git dependency.
How it works
A Scenario runs its steps in order. A Given or When step runs once. A Then step polls a probe every 2 seconds until the probe passes, fails, or reaches its deadline.
A probe records each failure in a ProbeDiag. The runner stops a step early when the same fatal failure repeats 3 times. On a timeout, the error includes the last recorded failure.
A small Fixture trait replaces decman's concrete fixture type. The trait has one method, which returns the fixture's ProbeDiag.
Key decisions
Only the generic core moved. decman keeps its fixture, its Canton helpers, its ~50 phases, and its HTTP failure rules. The 404 rule depends on how decman's frontend answers, so the rule stays in decman.
StepKind is private. Nothing outside the runner uses it, so the public API stays small.
The README is the crate documentation. Its example runs as a doctest, so the example cannot drift from the code.
CI mirrors decman's checks: fmt, clippy, tests, docs, cargo-audit, cargo-deny and cargo-machete. Dependabot covers cargo and GitHub Actions.
The license is Apache-2.0, the same as decman, because the code comes from decman.
How it was tested
20 unit tests pass. They are the runner and ProbeDiag tests from decman, ported to a stand-in fixture, plus four new tests: a failed step stops the scenario, a class change restarts a streak, ok records an error as transient, and clones share one record.
The README example passes as a doctest.
cargo fmt --check, cargo clippy -D warnings, cargo doc with -D warnings, cargo audit, cargo deny check advisories and cargo machete all pass locally.
decman compiles its full integration suite against this crate through a local path dependency. No phase needed an edit. Its 50 unit tests pass, and clippy is clean.
Follow-up
A decman PR replaces its copy of the runner with this crate. It pins the commit that this PR merges as.
decentralization-manager wrote its integration suite in a
Given/When/Then runner that lived in its test directory. Other repos
could not use the runner without copying it.
This commit moves the generic part of that runner into its own crate.
A small Fixture trait replaces the direct use of decman's fixture type.
Each consumer keeps its own rules for classifying a failed request,
because only the consumer knows its protocol.
CI mirrors decman's checks: fmt, clippy, tests, docs, cargo-audit,
cargo-deny and cargo-machete. Dependabot covers cargo and GitHub
Actions.
The runner checked a Then step's deadline only after a probe returned
None. A probe that never returned kept the scenario pending forever, and
a probe that answered after the deadline still passed the step.
Each probe call now runs under the step's deadline. When the deadline
passes, the runner cancels the call and reports the same timeout error,
with the last recorded probe failure.
CI runs both cargo-audit and cargo-deny, and each reads its own
advisory ignore list. The deny.toml header claimed cargo-deny was the
only gate, so an ignore added there alone would still fail Cargo Audit.
The new .cargo/audit.toml matches decman's layout, and the deny.toml
header now says which file each kind of ignore belongs in.
These trailing spaces are reused in the failure log and error context, whose format strings add another separator. A failing When step is therefore reported as WHEN "..." (and Then would behave the same if this label were used there). Keep labels unpadded; alignment should be applied only by the log formatter if needed.
The When and Then labels carried a trailing space so the step log lines
lined up. The failure log and the error context added their own
separator after the label, so a failed When step read `WHEN "..."`.
The labels are now plain words, and only the step log line pads them to
five characters. The log output is unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
This PR adds the first version of penelope, a Given/When/Then scenario runner for systems that become consistent over time.
Why
decentralization-manager wrote its integration suite in a runner that lived in
crates/decman/tests/common/. Other repos could not use the runner without copying it. This crate holds the generic part, so any repo can add it as a git dependency.How it works
Scenarioruns its steps in order. A Given or When step runs once. A Then step polls a probe every 2 seconds until the probe passes, fails, or reaches its deadline.ProbeDiag. The runner stops a step early when the same fatal failure repeats 3 times. On a timeout, the error includes the last recorded failure.Fixturetrait replaces decman's concrete fixture type. The trait has one method, which returns the fixture'sProbeDiag.Key decisions
StepKindis private. Nothing outside the runner uses it, so the public API stays small.How it was tested
ProbeDiagtests from decman, ported to a stand-in fixture, plus four new tests: a failed step stops the scenario, a class change restarts a streak,okrecords an error as transient, and clones share one record.cargo fmt --check,cargo clippy -D warnings,cargo docwith-D warnings,cargo audit,cargo deny check advisoriesandcargo macheteall pass locally.Follow-up
A decman PR replaces its copy of the runner with this crate. It pins the commit that this PR merges as.